import carla

def delete_all_vehicles(world):
    # 获取所有车辆
    vehicles = world.get_actors().filter('vehicle.*')

    # 遍历所有车辆并删除它们
    for vehicle in vehicles:
        vehicle.destroy()

# 连接到Carla服务器
client = carla.Client('127.0.0.1', 2000)
client.set_timeout(3.0)

# 获取世界
world = client.get_world()

# 删除所有车辆
delete_all_vehicles(world)
